<template>
    <el-card>
        <div slot="header">{{project.name}} 直播信息反馈
            <a target="_blank"
               v-if="report"
               :href="'/vpic/'+report.index">当天所有截图</a>
        </div>
        <el-table border :data="schedules" show-summary empty-text="没有主播数据">
            <el-table-column label="直播平台" prop="platform.name"/>
            <el-table-column label="主播名称" prop="anchor.name"/>
            <!--<el-table-column label="开始时间" prop="start"/>-->
            <!--<el-table-column label="结束时间" prop="end"/>-->
            <el-table-column label="最高在线" prop="online" sortable/>
            <el-table-column label="是否有二维码" prop="qrcode"/>
            <el-table-column label="弹幕数量" prop="danmu" sortable v-if="!project.options.hide.danmu"/>
            <el-table-column label="硬广截图">
                <template slot-scope="scope" v-if="!!scope.row.image">
                    <a class="el-button el-button--text"
                       :href="'/pic/'+scope.row.image.file+'/'+scope.row.image.file+'.jpg'" target="_blank">查看</a>
                </template>
            </el-table-column>
            <el-table-column label="主播截图">
                <template slot-scope="scope" v-if="scope.row.images && scope.row.images.length > 0">
                    <el-button @click="watchAnchorImages(scope.row.images)" type="text">
                        {{scope.row.images.length}} 张截图
                    </el-button>
                </template>
            </el-table-column>
            <el-table-column label="成本" prop="cost" sortable v-if="!project.options.hide.cost"/>
            <el-table-column label="点击" prop="click" sortable v-if="!project.options.hide.click"/>
            <el-table-column label="新增" prop="added" sortable v-if="!project.options.hide.added"/>
            <el-table-column label="回流" prop="reflux" sortable v-if="!project.options.hide.reflux"/>
            <el-table-column label="操作" v-if="editable">
                <template slot-scope="scope">
                    <router-link class="el-button el-button--text" target="_blank" :to="{
                    name: 'schedule',
                    params: {
                        project_id: project.id,
                        anchor_id: scope.row.anchor.id,
                        schedule_id: scope.row.id
                    }}">设置
                    </router-link>
                </template>
            </el-table-column>
        </el-table>
        <image_carousel :visible.sync="dialog" :data="images" mode="view"/>
    </el-card>
</template>

<script>

    import Image_carousel from "../component/image_carousel";

    export default {
        components: {Image_carousel},
        name: "report_schedules_data",
        props: {
            project: {
                required: true,
                default() {
                    return {options: {hide: {}}};
                }
            },
            report: {},
            schedules: {required: true, default: null},
            editable: {default: false},
        },
        data() {
            return {
                dialog: false,
                images: [],
            };
        },
        methods: {
            watchAnchorImages(images) {
                this.images = images;
                this.dialog = true;
            },
        }
    }
</script>

<style scoped>

</style>